package com.rong.creatmodel.singlemodel.example;

import java.lang.reflect.Constructor;

public class FSClient {
    public static void main(String[] args) throws Exception{
        // 通过反射破话单例模式
        // 获取字节码对象
        Class sing = Single.class;
        // 获取对象的构造方法
        Constructor c = sing.getDeclaredConstructor();
        // 取消访问检查
        c.setAccessible(true);
        Single obj = (Single) c.newInstance();
        Single obj1 = (Single) c.newInstance();
        System.out.println(obj1 == obj);

    }
}
